package java46.oo5;

public class Teacher {
	private String name;
	private int age;// 不能小雨22岁的约束

	public void setName(String n) {
		name = n;
	}

	public String getName() {
		return name;
	}

	public void setAge(int a) {
		if (a < 22) {
			System.err.println("年龄设置有问题，小于22岁");
			a = 22;// 默认值
		}
		age = a;
	}

	public int getAge() {
		return age;
	}

	private void increase() {
		age++;
	}

	public void selfIntroduction() {
		increase();
		System.out.println("我叫" + name + "，今年" + age + "岁");
	}
}
